import { post, get } from './axios'
//用户列表
export function userList(params:{}) { 
    return new Promise((resolve, reject)=>{
        post('/user/user/queryUser', params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}
//用户添加
export function addUser(params:{}) { 
  return new Promise((resolve, reject)=>{
      post('/user/user/addUser', params).then((data)=>{
          resolve(data);
      }).catch((error)=>{
          reject(error)
      })
  })
}

//退出登录
export function authLogout() { 
    return new Promise((resolve,reject)=>{
        post('/user/auth/logout').then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

// 用户批量删除
export function userDelUserBatch(params:{}) { 
    return new Promise((resolve, reject)=>{
        post('/user/user/delUserBatch', params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

// 用户修改
export function userEditUser(params:{}) { 
    return new Promise((resolve, reject)=>{
        post('/user/user/editUser', params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

// 用户状态修改
export function userChangeState(params:{}) { 
    return new Promise((resolve, reject)=>{
        post('/user/user/changeState', params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//用户详情
export function queryUserDetail(id:string) { 
    return new Promise((resolve, reject)=>{
        get('/user/user/queryUserDetail/' + id).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

// 重置密码
export function userResetPwd(params:{}) { 
    return new Promise((resolve, reject)=>{
        post('/user/user/resetPwd', params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//项目用户状态修改
export function userProjectChangeState(params:any) {
    return new Promise((resolve,reject)=>{
        post('/user/userProject/changeState',params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//项目用户批量删除
export function userProjectDelUserBatch(params:any) {
    return new Promise((resolve,reject)=>{
        post('/user/userProject/delUserBatch',params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//根据手机号码用户详情
export function queryUserDetailByMobile(params:any) {
    return new Promise((resolve,reject)=>{
        post('/user/user/queryUserDetailByMobile',params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//角色列表
export function roleQueryRole(params:{}) { 
    return new Promise((resolve, reject)=>{
        post('/user/role/queryRole', params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//角色添加
export function roleAddRole(params:{}) { 
    return new Promise((resolve, reject)=>{
        post('/user/role/addRole', params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//角色批量删除
export function roleDelRoleBatch(params:{}) { 
    return new Promise((resolve, reject)=>{
        post('/user/role/delRoleBatch', params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//角色修改
export function roleEditRole(params:{}) { 
    return new Promise((resolve, reject)=>{
        post('/user/role/editRole', params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}
//角色详情
export function roleView(id:string) { 
    return new Promise((resolve, reject)=>{
        get('/user/role/queryRoleDetail/' + id).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}
//角色状态修改
export function roleChangeState(params:{}) { 
    return new Promise((resolve, reject)=>{
        post('/user/role/changeState', params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//角色列表-不分页
export function queryRoleNoPage() { 
    return new Promise((resolve, reject)=>{
        get('/user/role/queryRoleNoPage').then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//资源管理
//查询页面左侧树形结构数据
export function queryResTreeNoBtn() { 
    return new Promise((resolve, reject)=>{
        get('/user/resource/queryResTreeNoBtn').then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//资源列表
export function resourceQueryRes(params:{}) { 
    return new Promise((resolve, reject)=>{
        post('/user/resource/queryRes', params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//资源添加
export function resourceAddRes(params:{}) { 
    return new Promise((resolve, reject)=>{
        post('/user/resource/addRes', params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//资源批量删除
export function resourceDelResBatch(params:{}) { 
    return new Promise((resolve, reject)=>{
        post('/user/resource/delResBatch', params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//资源修改
export function resourceEditRes(params:{}) { 
    return new Promise((resolve, reject)=>{
        post('/user/resource/editRes', params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//资源状态修改
export function resourceChangeState(params:{}) { 
    return new Promise((resolve, reject)=>{
        post('/user/resource/changeState', params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//查询资源列表树:false-不包含总平台
export function resourceQueryResTree(needTotal: Boolean) { 
    return new Promise((resolve, reject)=>{
        get('/user/resource/queryResTree?needTotal=' + needTotal).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//获取用户资源
export function queryMenuTree(params:{}) { 
    return new Promise((resolve, reject)=>{
        // get('/user/resource/queryMenuTree',params).then((data)=>{
        get('/user/resource/multiPlatformMenuTree',params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

// 部门管理
// 部门列表
export function dptQueryDpt(params:{}) { 
    return new Promise((resolve, reject)=>{
        post('/user/dpt/queryDpt', params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

// 部门添加
export function dptAddDpt(params:{}) { 
    return new Promise((resolve, reject)=>{
        post('/user/dpt/addDpt', params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

// 部门批量删除
export function dptDelDptBatch(params:{}) { 
    return new Promise((resolve, reject)=>{
        post('/user/dpt/delDptBatch', params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

// 部门修改
export function dptEditDpt(params:{}) { 
    return new Promise((resolve, reject)=>{
        post('/user/dpt/editDpt', params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

// 部门列表-不分页
export function dptQueryDptNoPage(params?:{}) { 
    return new Promise((resolve, reject)=>{
        get('/user/dpt/queryDptNoPage',params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

// 部门列表-用户树级结构
export function getDeptTreeData(params?:{}) { 
    return new Promise((resolve, reject)=>{
        get('/user/dpt/getDeptTreeData',params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

// 查询平台
export function queryPlatform() { 
    return new Promise((resolve, reject)=>{
        get('/user/resource/queryPlatform').then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//获取BIm资源
export function queryTreeData(params:{}) { 
    return new Promise((resolve, reject)=>{
        get('/user/resBim/queryTreeData',params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}